<%@ page contentType="text/html; charset=utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<%String skin = (String) session.getAttribute("USERSKIN_SESSION");%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <!-- 卷/件管理 -->
    <title>山西省审计厅档案综合管理系统</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <jsp:include page="/inc/head.jsp" flush="true"/>
</head>
<style>
</style>
<body>
<div class="panel-body" style="padding-bottom:0px;">
    <div class="panel panel-default">
        <div class="panel-heading">正在使用的检索范围</div>
        <div class="panel-body">
            <div id="mainBoby1" class="one" >
                <input type="text" id='searchScope' class="form-control" name='searchScopeName' style="width:35%;height:35px" value='' readonly/>
            </div>

        </div>
    </div>
    <div class="panel panel-default">
        <div class="panel-heading">重置检索范围</div>
        <div class="panel-body">
            <div id="mainBoby2" class="one" style="width:59%">
                <select  id="chooseSetCode"  style="width:60%;height:35px;display:inline-block;"  class="form-control">
                </select>
                <button type="button" style="margin-left:50px" id="btn_clean" onclick="searchScopeClean()" class="btn btn-primary">重置</button>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/inc/footer.jsp" flush="true"/>
<script>
    $(function(){
         defaultSearchScopeSign();
         findAllSearchScopeSign();
    });
    function defaultSearchScopeSign() {
        $.ajax({
            type: "POST",
            url:"${pageContext.request.contextPath }/pcwindow/findAllSearchScopeAction",
            type:"post",
            dataType:"json",
            success:function(data){
                if (data.length != 0) {
                    var chooseSet = data.rows;
                    var str = '';
                    for(var i = 0;i < chooseSet.length ;i++){
                        var tyname=chooseSet[i].remarks;
                        var tydec=chooseSet[i].description;
                        var sign=chooseSet[i].str2;
                        if(sign == 1){
                          str =  tydec+"----"+tyname;
                        }
                    }
                    if(str == ''){
                        $("#searchScope").val("未设置检索范围----默认检索全部已归档目录");
                    }else{
                        $("#searchScope").val(str);
                    }
                }
            }
        });
    }

    function searchScopeClean() {
        var chooseSetCode=$("#chooseSetCode").find(":selected").val();
        $.ajax({
            type: "POST",
            url:"${pageContext.request.contextPath }/pcwindow/searchScopeCleanAction",
            data:{
                chooseSet:chooseSetCode,
            },
            type:"post",
            dataType:"json",
            success:function(result){
                if(result.status == "200"){
                    confirmEvent('检索范围重置成功');
                    defaultSearchScopeSign(1);
                }else{
                    confirmEvent('检索范围重置失败，请稍后重试');
                }
            }
        });
    }

    /**
     *	加载所有的检索范围
     */
    function findAllSearchScopeSign(){
        $.ajax({
            type: "POST",
            url:"${pageContext.request.contextPath }/pcwindow/findAllSearchScopeAction",
            dataType:"json",
            async:false,
            success: function(data){
                if (data.length != 0) {
                    var chooseSet = data.rows;
                    var str = '<option value="0">-----请选择检索范围-----</option>';
                    for(var i = 0;i < chooseSet.length ;i++){
                        var tyname=chooseSet[i].remarks;
                        var tydec=chooseSet[i].description;
                        var tyid=chooseSet[i].code;
                        str += '<option value="'+ tyid +'">'+ tydec +"----"+ tyname +'</option>'
                    }
                    $('#chooseSetCode').html(str);
                }
            }
        });
    }
</script>
</body>
</html>

